package com.qf.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsCategoryMapper;
import com.qf.pojo.DtsCategory;
import com.qf.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private DtsCategoryMapper dtsCategoryMapper;

    @Override
    public List<DtsCategory> selectList(Integer pid) {

        QueryWrapper<DtsCategory> wrapper = new QueryWrapper<>();
        wrapper.select("id","name");
        wrapper.eq("deleted", false);
        wrapper.eq("pid", pid);
        List<DtsCategory> parentCategories = dtsCategoryMapper.selectList(wrapper);
        return parentCategories;
    }
}
